<template>
  <div>
      <nav>
        <img @click="onClose" src="./imgs/icon-left.png" alt="">
        <p>收益明细</p>
      </nav>
      <Row class="body">
        <i-col span="6">收益金额</i-col>
        <i-col span="4">动账类型</i-col>
        <i-col span="4">来源编号</i-col>
        <i-col span="10">操作时间</i-col>
      </Row>

      <Row class="list" v-for="(item) of userList" :key="item.name">

        <i-col span="6">{{item.money}}</i-col>
        <i-col v-if="item.type==1" span="4">提现</i-col>
        <i-col v-else-if="item.type==2" span="4">购买pos机</i-col>
        <i-col v-else-if="item.type==13" span="4">本人刷卡</i-col>
        <i-col v-else-if="item.type==14" span="4">徒弟刷卡</i-col>
        <i-col v-else-if="item.type==4" span="4">立即办卡</i-col>
        <i-col v-else span="4">其他</i-col>
        <i-col span="4">{{item.fromUserId}}</i-col>
        <i-col span="10">{{item.time}}</i-col>
      </Row>

    <div class="page">
      <Page :total="total" :page-size="pageSize" @on-change="handlePage"></Page>
    </div>
  </div>

</template>

<script>
import axios from 'axios'
export default {
  name: 'GainRecord',
  data () {
    return {
        pageSize:10,
        pageNumber:1,
        total:0,
        userList:'',
        self: this,
      }
  },
  methods: {
    onClose(){
      this.$router.back(-1)
    },
    getListInfo () {
      console.log('tag', this.$store.state.user)
      axios.post('/web/api/manager/yhuy',{"pageSize":this.pageSize,"pageNumber":this.pageNumber,"userId":this.$store.state.user.userId}).then(this.getListInfoSucc)
    },
    getListInfoSucc (res) {
      console.log('tag', res)
      this.total = res.data.date.total
      this.userList = res.data.date.list
    },
    handlePage (res){
      axios.post('/web/api/manager/yhuy',{"pageSize":this.pageSize,"pageNumber":res,"userId":this.$store.state.user.userId}).then(this.getListInfoSucc)
    },
  },
  mounted () {
    // var arr = [];
    // for(var i=0;  i<10;  i++){
    //   console.log('i==', i)
    //     arr [i] = function(){
    //         alert(i)
    //     }
    // }
    // console.log('arr==', arr)
    // arr[8]();
    if(!this.$store.state.show){
      this.$router.push({path: '/repayment'});
    }
    this.getListInfo();
  }
}
</script>
<style lang="stylus" scoped>
bgBlue = linear-gradient(to right, #04befe, #4481eb)
nav
    width 100%
    height 50px
    background bgBlue
    img
        display inline-block
        float left
        width 25px
        height 25px
        margin 12px 10px
    p
        display inline-block
        width 80%
        float left
        font-size 18px
        color #ffffff
        text-align center
        line-height 50px
  .body
    width: 100%
    line-height 3
    font-size 14px
    color #2680c4
    background #eff3fa
    text-align center
  .list
    line-height 3
    font-size 14px
    text-align center
    color #2680c4
  .sousuo
    width 100%
    text-align center
    margin-top 2rem
    margin-bottom 2rem
  .page
    width 100%
    margin-top 2rem
    text-align center
</style>

